package org.bugjail.servlet.form.create;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.bugjail.data.TestCase;
import org.bugjail.servlet.BasicUIServlet;

/**
 * Servlet implementation class for Servlet: NewSuiteFormServlet
 * 
 */
public class NewSimpleTestCaseFormServlet extends BasicUIServlet {

	static final long serialVersionUID = 1L;

	@Override
	protected void write(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

		int suiteid = Integer.parseInt(request
				.getParameter("suiteid"));

		PrintWriter pw = response.getWriter();

		pw.println("<form method='post' action='NewSimpleTestCaseServlet'>");
		pw.println("Test case name:<br><input type='text' name='name' maxlength='50' /><br>");
		pw.println("Objective:<br><textarea name='objective'></textarea><br>");
		pw.println("<input type=hidden name='suiteid' value='"
				+ suiteid + "' />");
		
		//SEVERITY
		pw.println("Severity: ");
		pw.println("<input type='radio' name='severity' value='"+TestCase.SEVERITY_0+"' checked=true ><img src='images/priority01.png'/></input>");
		pw.println("<input type='radio' name='severity' value='"+TestCase.SEVERITY_1+"' ><img src='images/priority02.png'/></input>");
		pw.println("<input type='radio' name='severity' value='"+TestCase.SEVERITY_2+"' ><img src='images/priority03.png'/></input>");
		pw.println("<input type='radio' name='severity' value='"+TestCase.SEVERITY_3+"' ><img src='images/priority04.png'/></input>");
		pw.println("<input type='radio' name='severity' value='"+TestCase.SEVERITY_4+"' ><img src='images/priority05.png'/></input>");
		
		pw.println("<input type=submit value='Create' />");
		pw.println("&nbsp;<a href='TestCaseServlet?suiteid="+suiteid+"'>Cancel</a>");
		pw.println("</form>");
	}

	@Override
	protected String pageTitle() {
		return "Create new simple test case";
	}

	@Override
	protected void beforeAction(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		
	}
}